package com.jh.user.controller.model;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.jh.user.pojo.BrandRate;
import com.jh.user.pojo.enums.ChannelMerType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author Yichuan
 * @version 1.0
 */
public class BrandRateVO implements Serializable {

    private static final long serialVersionUID = 6572236769587556557L;

    public static BrandRateVO transform(BrandRate brandRate) {
        BrandRateVO vo = new BrandRateVO();
        vo.setId(brandRate.getId());
        vo.setBrandId(brandRate.getBrandId());
        vo.setChannelId(brandRate.getChannelId());
        vo.setUserGrade(brandRate.getUserGrade().getValue());
        vo.setRate(brandRate.getRate());
        vo.setMinrate(brandRate.getMinrate());
        vo.setExtraFee(brandRate.getExtraFee());
        vo.setGradeRate(brandRate.getGradeRate());
        vo.setStatus(brandRate.getStatus());
        vo.setPayType(brandRate.getPayType());
        vo.setUpdateTime(brandRate.getUpdateTime());
        vo.setCreateTime(brandRate.getCreateTime());
        vo.setBrandRate(brandRate.getBrandRate());
        vo.setChannelMerType(ChannelMerType.of(brandRate.getChannelMerType()).getDesc());
        return vo;
    }

    public static List<BrandRateVO> transform(List<BrandRate> rateList) {
        if (rateList == null || rateList.isEmpty()) {
            return ImmutableList.of();
        }
        List<BrandRateVO> result = Lists.newLinkedList();
        for (BrandRate brandRate: rateList) {
            result.add(BrandRateVO.transform(brandRate));
        }
        return result;
    }

    private long id;
    private long brandId;
    private long channelId;
    private Short userGrade;
    private BigDecimal rate;
    private BigDecimal minrate;
    private BigDecimal extraFee;
    private BigDecimal gradeRate;
    private String status;
    private Short payType;
    private Date updateTime;
    private Date createTime;
    private BigDecimal brandRate;
    private String channelMerType;

    public String getChannelMerType() {
        return channelMerType;
    }

    public void setChannelMerType(String channelMerType) {
        this.channelMerType = channelMerType;
    }

    public BrandRateVO() {
    }

    public BigDecimal getBrandRate() {
        return brandRate;
    }

    public void setBrandRate(BigDecimal brandRate) {
        this.brandRate = brandRate;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getBrandId() {
        return brandId;
    }

    public void setBrandId(long brandId) {
        this.brandId = brandId;
    }

    public long getChannelId() {
        return channelId;
    }

    public void setChannelId(long channelId) {
        this.channelId = channelId;
    }

    public Short getUserGrade() {
        return userGrade;
    }

    public void setUserGrade(Short userGrade) {
        this.userGrade = userGrade;
    }

    public BigDecimal getRate() {
        return rate;
    }

    public void setRate(BigDecimal rate) {
        this.rate = rate;
    }

    public BigDecimal getMinrate() {
        return minrate;
    }

    public void setMinrate(BigDecimal minrate) {
        this.minrate = minrate;
    }

    public BigDecimal getExtraFee() {
        return extraFee;
    }

    public void setExtraFee(BigDecimal extraFee) {
        this.extraFee = extraFee;
    }

    public BigDecimal getGradeRate() {
        return gradeRate;
    }

    public void setGradeRate(BigDecimal gradeRate) {
        this.gradeRate = gradeRate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Short getPayType() {
        return payType;
    }

    public void setPayType(Short payType) {
        this.payType = payType;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
